
    <!--[if lt IE 9]><script language="javascript" type="text/javascript" src="excanvas.js"></script><![endif]-->
    
    <script type="text/javascript" src="<?php echo base_url();?>data/js/jquery.jqplot.min.js"></script>
    <script type="text/javascript" src="<?php echo base_url();?>data/js/plugins/jqplot.pieRenderer.min.js"></script>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>data/css/jquery.jqplot.min.css" />

    <title>Halaman Administrasi</title>
</head>

<body onload="getTime();">

<div id="container">
  <div id="header">
    <div id="logoHeader"></div>
    <div id="accountName">
    	<div id="accountInfo">
    	  <p><span id="date"></span>&nbsp;<span id="clock"></span></p>
          <br />
          <p>Welcome, <?php echo $nama_akun; ?></p>
        </div>
    </div>
  <br class="clearfloat"/>
  </div>
  <!-- end #header -->
  <div id="naviLink">
    <ul id="navUL">
    	<li><a href="<?php echo site_url('main/beranda');?>">Beranda</a></li>
    	<li><a href="<?php echo site_url('main/admin');?>">Admin</a></li>
    	<li><a href="<?php echo site_url('main/penjualan');?>">Penjualan</a></li>
    	<li><a href="<?php echo site_url('main/inventaris');?>">Inventaris</a></li>
        <li><a href="<?php echo site_url('main/pembelian');?>">Pembelian</a></li>
    	<li><a href="<?php echo site_url('main/log');?>">Log</a></li>
    </ul>
    <div id="divLogOut"><a href="<?php echo site_url('main/log_out');?>">Log Out</a></div>
  </div>
  <div id="mainContent">
  
  	<div id="contentInfo">
    	<div id="adminInfo">
        	<a>Penjualan</a>
        </div>
        <br class="clearfloat" />       
        
    </div>
    
    <form method="post" action="<?php echo site_url('main/reports');?>">
    
        <table id="TablePenjualan">
            <tr>
                <td>Bulan &amp; Tahun</td>
                <td> :
                
                    <select name="month">
                        <option value="1">Januari</option>
                        <option value="2">Februari</option>
                        <option value="3">Maret</option>
                        <option value="4">April</option>
                        <option value="5">Mei</option>
                        <option value="6">Juni</option>
                        <option value="7">Juli</option>
                        <option value="8">Agustus</option>
                        <option value="9">September</option>
                        <option value="10">Oktober</option>
                        <option value="11">Nopember</option>
                        <option value="12">Desember</option>
                    </select>
                
                    <select name="year">
                        <option value="2012">2012</option>
                        <option value="2011">2011</option>
                        <option value="2010">2010</option>
                        <option value="2009">2009</option>
                        <option value="2008">2008</option>
                    </select>
                
                </td>
            </tr>
            <tr>
                <td>Restoran</td>
                <td> :
                
                    <select name="restoran">
                        <option value="sf">Second Floor</option>
                        <option value="cox">Cox Bar</option>
                        <option value="velpa">Velpa Bar</option>
                    </select>
                
                </td>
            </tr>
            <tr>
                <td>Jenis Laporan</td>
                <td> :
                
                    <select name="type">
                        <option value="s">Penjualan/Sales</option>
                        <option value="p">Pembayaran</option>
                    </select>
                
                </td>
            </tr>
            <tr>
                <td><input id="submitButton" type="submit" value="Submit" /></td>
            </tr>
        </table>
        
    </form>
    
    <div id="DataTersembunyi" <?php echo $styleDisplay;?>>
    
    <?php 
   
    $bulan1 = null;
   
    switch (strtolower($bulan)){
        case null: break;
        case "1": $bulan1 = "Januari"; break;
        case "2": $bulan1 = "Februari"; break;
        case "3": $bulan1 = "Maret"; break;
        case "4": $bulan1 = "April"; break;
        case "5": $bulan1 = "Mei"; break;
        case "6": $bulan1 = "Juni"; break;
        case "7": $bulan1 = "Juli"; break;
        case "8": $bulan1 = "Agustus"; break;
        case "9": $bulan1 = "September"; break;
        case "10": $bulan1 = "Oktober"; break;
        case "11": $bulan1 = "Nopember"; break;
        case "12": $bulan1 = "Desember"; break;
    }
    ?>
    
        <div id="HeaderLaporan">
            <p>Laporan <?php echo $tipe. " " .$restoran;?> Bulan <?php echo $bulan1." ".$tahun;?> </p>
        </div>
        
        <div id="DownloadLaporan">
            <a href="<?php echo site_url('main/generate_report');?>">
                <div><img src="<?php echo base_url();?>data/img/download_ico.png" /></div>
                <div id="txt">&nbsp;&nbsp;&nbsp;Download</div>
            </a>
        </div>
        
        <br class="clearfloat" />
        
        <div id="KontenLaporan">
   
        <script type="text/javascript">
        /*var $j = jQuery.noConflict();
     
        // Use jQuery via $j(...)
            $j(function() {
            	// setup ul.tabs to work as tabs for each div directly under div.panes
            	$j("ul.mytabs").tabs("div.panes > div");
            });*/
        </script>
            
            <div id="KontenLink">
            
                <ul class="mytabs">
                    <li><a href="#">Summary</a></li>
                    <li <?php echo $displayHidden;?>><a href="#">Grafik Kumulatif</a></li>
                    <li <?php echo $displayHidden;?>><a href="#">Grafik Harian</a></li>
                    <li><a href="#">Grafik Kategori</a></li>
                </ul>
            </div>
            
            <div class="panes">
            
                <div>
                
   <?php if(isset($sales)): ?>
        <div>SUMMARY SALES REPORT SF BULAN <?php echo $bulan1;?> TAHUN <?php echo $tahun;?></div>
        <br />
        <table class="summaryTable">
            <tr>
                <th rowspan="2">DAY</th>
                <th rowspan="2">DATE</th>
                <th rowspan="2">FOOD</th>
                <th rowspan="2">BEVERAGE</th>
                
                <?php
                
                    if(strtolower($restoran )== "velpa"){
                        echo '<th>WINE</th>';
                    }
                
                ?>
                                
                <th rowspan="2">TOBACO</th>
                <th rowspan="2">OTHERS</th>
                <th colspan="2">DISCOUNT</th>
                <th rowspan="2">TAX</th>
                <th rowspan="2">SERVICE</th>
                <th rowspan="2">ROUNDING</th>
                <th rowspan="2">TOTAL</th>
                <th rowspan="2">SUBTOTAL</th>
                <th rowspan="2">MONTH TO DATE</th>
            </tr>
            <tr>
                
                <?php
                
                    if(strtolower($restoran ) == "velpa"){
                        echo '<th>TAKE AWAY</th>';
                    }
                
                ?>
                
                <th>CUSTOMER</th>
                <th>ENT/OC</th>
            </tr>
            
            <?php
                
                $beverage = null;
                $food = null;
                $wine_takeaway = null;
                $tobaco = null;
                $others = null;
                $discount_customer = null;
                $discount_ocheck = null;
                $rounding = null;
                $net_sales = null;
                $tax = null;
                $service = null;
                $subtotal = null;
            
            
                $month_to_date = 0; // cumulative subtotal
                foreach($sales as $val):
                    $time = strtotime($val['date']);
                    
                    $food = $food + $val['food'];
                    $beverage = $beverage + $val['beverage'];
                    $wine_takeaway = $wine_takeaway + $val['wine_takeaway'];
                    $tobaco = $tobaco + $val['tobaco'];
                    $others = $others + $val['others'];
                    $discount_customer = $discount_customer + $val['discount_customer'];
                    $discount_ocheck = $discount_ocheck + $val['discount_ocheck'];
                    $tax = $tax + $val['tax'];
                    $service = $service + $val['service'];
                    $rounding = $rounding + $val['rounding'];
                    $net_sales = $net_sales + $val['net_sales'];
                    $subtotal = $subtotal + $val['subtotal'];
            ?>
            <tr>
                <?php $month_to_date += $val['subtotal'] ?>
                <td><?=date("D",$time)?></td>
                <td><?=date("d/m/Y",$time)?></td>
                <td><?=number_format($val['food'],0,',','.')?></td>
                <td><?=number_format($val['beverage'],0,',','.')?></td>
                
                <?php
                
                    if(strtolower($restoran ) == "velpa"){
                        echo '<td>'.number_format($val['wine_takeaway'],0,',','.').'</td>';
                    }
                
                ?>
                
                <td><?=number_format($val['tobaco'],0,',','.')?></td>
                <td><?=number_format($val['others'],0,',','.')?></td>
                <td><?=number_format($val['discount_customer'],0,',','.')?></td>
                <td><?=number_format($val['discount_ocheck'],0,',','.')?></td>
                <!-- <td><?=number_format($val['discount'],0,',','.')?></td> -->
                <td><?=number_format($val['tax'],0,',','.')?></td>
                <td><?=number_format($val['service'],0,',','.')?></td>
                <td><?=number_format($val['rounding'],0,',','.')?></td>
                <td><?=number_format($val['net_sales'],0,',','.')?></td>
                <td><?=number_format($val['subtotal'],0,',','.')?></td>
                <td><?=number_format($month_to_date,0,',','.')?></td>
            </tr>
            <?php 
                endforeach;
                
                $colspan = '14';
                
                if(strtolower($restoran ) == "velpa"){
                    $colspan = '15';
                }
            ?>
            <tr>
                <td colspan="<?php echo $colspan;?>"></td>
            </tr>
            <tr>
                <td colspan="<?php echo $colspan;?>"></td>
            </tr>
            
            <tr>
                <td class="jumlahTotal" colspan="2">TOTAL</td>
                <td class="jumlahTotal"><?php echo number_format($food,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($beverage,0,',','.');?></td>
                
                <?php
                
                    if(strtolower($restoran ) == "velpa"){
                        echo '<td class="jumlahTotal">'.number_format($wine_takeaway,0,',','.').'</td>';
                    }
                
                ?>
                <td class="jumlahTotal"><?php echo number_format($tobaco,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($others,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($discount_customer,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($discount_ocheck,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($tax,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($service,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($rounding,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($net_sales,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($subtotal,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($month_to_date,0,',','.');?></td>
            </tr>
        </table>
        <?php endif; ?>
        
        <?php if(isset($payment)): ?>
        <div>SF PAYMENT BULAN <?php echo $bulan1;?> TAHUN <?php echo $tahun;?></div>
        <br />
        <table class="summaryTable">
            <tr>
                <th rowspan="2">DATE</th>
                <th>SALES</th>
                <th colspan="4">SALES CARD</th>
                <th rowspan="2">CL</th>
                <th rowspan="2">VOUCHER</th>
                <th rowspan="2">TOTAL</th>
                <th rowspan="2">MONTH TO DATE</th>
            </tr>
            <tr>
                <th>CASH</th>
                <th>VISA</th>
                <th>MASTER</th>
                <th>BCA CARD</th>
                <th>DEBIT</th>
            </tr>
            <?php
            
            $cash = null;
            $visa = null;
            $master = null;
            $bca_card = null;
            $debit = null;
            $city_ledger = null;
            $voucher = null;
            $total = null;
            
            $month_to_date = 0; // cumulative subtotal
            foreach($payment as $val):
            
            $cash = $cash + $val['cash'];
            $visa = $visa + $val['visa'];
            $master = $master + $val['master'];
            $bca_card = $bca_card + $val['bca_card'];
            $debit = $debit + $val['debit'];
            $city_ledger = $city_ledger + $val['city_ledger'];
            $voucher = $voucher + $val['voucher'];
            $total = $total + $val['total'];
            ?>
            <tr>
                <?php $month_to_date += $val['total'] ?>
                <td><?=date("d/m/Y",strtotime($val['date']))?></td>
                <td><?=number_format($val['cash'],0,',','.')?></td>
                <td><?=number_format($val['visa'],0,',','.')?></td>
                <td><?=number_format($val['master'],0,',','.')?></td>
                <td><?=number_format($val['bca_card'],0,',','.')?></td>
                <td><?=number_format($val['debit'],0,',','.')?></td>
                <td><?=number_format($val['city_ledger'],0,',','.')?></td>
                <td><?=number_format($val['voucher'],0,',','.')?></td>
                <td><?=number_format($val['total'],0,',','.')?></td>
                <td><?=number_format($month_to_date,0,',','.')?></td>
            </tr>
            <?php endforeach; ?>
            
            <tr>
                <td colspan="10"></td>
            </tr>
            <tr>
                <td colspan="10"></td>
            </tr>
            
            <tr>
                <td class="jumlahTotal" colspan="1">TOTAL</td>
                <td class="jumlahTotal"><?php echo number_format($cash,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($visa,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($master,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($bca_card,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($debit,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($city_ledger,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($voucher,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($total,0,',','.');?></td>
                <td class="jumlahTotal"><?php echo number_format($month_to_date,0,',','.');?></td>
            </tr>
            
        </table>
        <?php endif; ?>
        
                    
                    
                </div>
                
                <div <?php echo $displayHidden;?>>
                    <p>
                        Grafik Kunulatif Grafik Kunulatif Grafik Kunulatif
                    </p>
                </div>
                
                <div <?php echo $displayHidden;?>>
                    <p>
                        Grafik Harian Grafik Harian Grafik Harian
                    </p>
                </div>
                
                <div>
                    <p>
                        Grafik Kategori Grafik Kategori Grafik Kategori
                    </p>
                    

<script type="text/javascript">

$(document).ready(function(){
    $.jqplot.config.enablePlugins = false;
    
    var data = [['Cash', <?php echo $cash;?>],
                ['Visa', <?php echo $visa;?>],
                ['Master', <?php echo $master;?>],
                ['BCA Card', <?php echo $bca_card;?>],
                ['Debit', <?php echo $debit;?>],
                ['City Ledger', <?php echo $city_ledger;?>],
                ['Voucher', <?php echo $voucher;?>]];
    
    $("ul.mytabs").tabs("div.panes > div");
    
    var plot1 = $.jqplot ('chartdiv', [data], 
    {
        height: 300,
        width: 300,
        title: 'Pembayaran Per Kategori',
        series:[{renderer:$.jqplot.PieRenderer}],
        legend:{show:true}
    });
    
    $('ul.mytabs').bind('tabsshow', function(event, ui) {
      if (ui.index == 1 && plot1._drawCount == 0) {
        plot1.replot();
      }
    });
});

</script>



                    <div id="chartdiv" style="height:400px;width:600px; "></div>
                    
                </div>
            </div>
            
            
        </div>

    </div>
    
  	<br/>
    <!-- end #mainContent -->
  </div>
  
